package com.example.springbootdemo.threadpool;

public class App {

    public static void main(String[] args) throws InterruptedException {
        MyThreadPool tp = new MyThreadPool();

        for (int i = 0; i < 100 ;i ++) {
            // todo i 的问题
            int finalI = i;
            Thread.sleep(300);
            Runnable a = () ->{
                try {
                    Thread.sleep(1000);
                    System.out.println("执行任务" + finalI + " 线程名："+Thread.currentThread().getName());
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            };
            tp.execute(a);
        }

        System.out.println("主线程执行完成。。。");
    }


}
